package com.mxpio.erp.common.quality.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author : wpp
 * @Datetime : 2023/6/6 14:32
 * @Desc :
 * @Modor :  Modifytime:
 * @modDesc : 工序过程报废记录（临时功能）
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_QUALITY_PROCESS_MATERIAL_SCRAP")
@Schema(description="工序过程报废(原材料、半成品)记录")
public class ProcessMaterialScrap extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @Generator(policy = UUIDPolicy.class)
    @Column(name = "ID_", length = 64)
    @Schema(description = "ID主键")
    private String id;

    @Schema(description = "班组")
    @Column(name = "WORK_TEAM_" )
    @Dict(dicCode = "ERP_QUAL_TEMP_WORK_TEAM")
    private String workTeam;

    @Column(name = "ITEM_CODE_")
    @Schema(description = "物料编码")
    private String itemCode;

    @Column(name = "ITEM_NAME_")
    @Schema(description = "物料名称")
    private String itemName ;

    @Column(name = "DRAWING_NO_")
    @Schema(description = "图号")
    private String drawingNo;

    @Column(name = "PROCESS_CODE_", updatable = false)
    @Schema(description  = "工序编码")
    private String processCode;
    /**工序名称*/
    @Column(name = "PROCESS_NAME_" )
    @Schema(description  = "工序名称")
    private String processName;

    @Column(name = "RESPONSE_PERSON_")
    @Schema(description = "责任人")
    private String responsePerson;

    @Column(name = "RESPONSE_UNIT_")
    @Schema(description = "责任单位")
    private String responseUnit;

    @Column(name = "SCRAP_DATE_")
    @Schema(description = "报废日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date scrapDate;

    @Column(name = "SCRAP_QANTITY_")
    @Schema(description = "报废数量")
    private BigDecimal scrapQuantity;

    @Column(name = "MEMO_")
    @Schema(description = "备注")
    private String memo;

    @Dict(dicCode = "ERP_COMMON_YESNO")//
    @Schema(description = "是否提交")
    @Column(name = "DATA_STATUS_")
    private String dataStatus;

    @Dict(dicCode = "MB_ERP_QUALITY_PROCESS_MATERIAL_SCRAP_END_PHASE")
    @Schema(description = "报废阶段")
    @Column(name = "END_PHASE_")
    private String endPhase; //10 工序检验 20 成品检验
}
